﻿#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
#include <string>
#include <mutex>

#ifndef BUILD_STATIC
# if defined(TRCURLUTILS_LIB)
#  define TRCURLUTILS_EXPORT __declspec(dllexport)
# else
#  define  TRCURLUTILS_EXPORT __declspec(dllimport)
# endif
#else
# define  TRCURLUTILS_EXPORT
#endif


class TRCURLUTILS_EXPORT TrCurlUtils
{
public:
    TrCurlUtils(bool debug = false);
    ~TrCurlUtils();
public:
    int Post(const std::string& strUrl, const std::string& strPost, std::string& strResponse);
    int Get(const std::string& strUrl, std::string& strResponse);
    int Posts(const std::string& strUrl, const std::string& strPost, std::string& strResponse, const char* pCaPath = NULL);
    int Gets(const std::string& strUrl, std::string& strResponse, const char* pCaPath = NULL);

private:
    bool m_bDebug;
};

